import request from "@/utils/request.js";

export function getMenus() {
  return request({
    method: "GET",
    url: "menus",
  });
}
export function getRights(type) {
  return request({
    method: "GET",
    url: `rights/${type}`,
  });
}

export function getRoles() {
  return request({
    method: "GET",
    url: "roles",
  });
}

export function removeRightById(roleId, rightId) {
  return request({
    method: "delete",
    url: `roles/${roleId}/rights/${rightId}`,
  });
}

export function allotRights(roleId, data) {
  return request({
    method: "post",
    url: `roles/${roleId}/rights`,
    data,
  });
}

export function addRoles(data) {
  return request({
    method: "post",
    url: "roles",
    data,
  });
}
export function delRoles(id) {
  return request({
    method: "delete",
    url: `roles/${id}`,
  });
}
export function getIdRoles(id) {
  return request({
    method: "get",
    url: `roles/${id}`,
  });
}
export function editSubmit(data) {
  return request({
    method: "put",
    url: `roles/${data.id}`,
    data,
  });
}
